ECHO OFF

ECHO.
ECHO This step will create copies of ntoskrnl and winload for patching.
ECHO.

REM %SYSTEMDRIVE%
REM cd %USERPROFILE%\DESKTOP
REM mkdir %USERPROFILE%\DESKTOP\PATCHTEMP
set PATCHTEMP=%CD%
cd %PATCHTEMP%
echo y | copy %WINDIR%\SYSTEM32\winload.exe %PATCHTEMP%\osloader.exe
echo y | copy %WINDIR%\SYSTEM32\ntoskrnl.exe %PATCHTEMP%\ntkrnlmp.exe

set OLD_GUID={46595952-454E-4F50-4747-554944FFFFFF}

ECHO.
ECHO Delete BCD Entry, if existing...
bcdedit -delete %ENTRY_GUID%
bcdedit -delete %OLD_GUID%
ECHO.

ECHO.
ECHO Creating BCD Entry...
ECHO.

set ENTRY_GUID={46595952-454E-4F50-4747-554944FEEEEE}
bcdedit -create %ENTRY_GUID% -d "PatchGuard Disabled v2" -application OSLOADER
bcdedit -set %ENTRY_GUID% device partition=%SYSTEMDRIVE%
bcdedit -set %ENTRY_GUID% osdevice partition=%SYSTEMDRIVE%
bcdedit -set %ENTRY_GUID% systemroot \Windows
bcdedit -set %ENTRY_GUID% path \Windows\system32\osloader.exe
bcdedit -set %ENTRY_GUID% kernel ntkrnlmp.exe
bcdedit -set %ENTRY_GUID% recoveryenabled 0
bcdedit -set %ENTRY_GUID% nx OptIn
bcdedit -set %ENTRY_GUID% nointegritychecks 1
bcdedit -set %ENTRY_GUID% inherit {bootloadersettings}

bcdedit -displayorder %ENTRY_GUID% -addlast
bcdedit -timeout 10

ECHO.
ECHO Setting PEAUTH service to manual... (avoid BSOD at login screen)
ECHO.
sc config peauth start= demand

ECHO.
ECHO Step One Complete!  Please run 2.exe =)
ECHO.
PAUSE